import request from '@/utils/request'
// 定义标签接口
export interface Tag {
    id: number;
    name: string;
    created_at: string;
    article_count: number;
}
interface Article {
    id: number;
    title: string;
    created_at: string;
}
export const tagApi = {
    // 获取标签列表
    getTags(): Promise<Tag[]> {
        return request({
            url: '/api/tags',
            method: 'get'
        })
    },
    // 获取标签下的所有文章
    getArticlesByTag(tagId: number): Promise<Article[]> {
        return request({
            url: `/api/tags/${tagId}/articles`,
            method: 'get'
        })
    }
}